Repository navigation
client: the error toast keeps the host's code and offers Reload on a read-only refusal - #2367
Conversation
…read-only refusal A refused action away from any form lost the host's code, so a second-holder refusal read as a bare sentence with no way to act on it. reportError now carries error.code into the toast and a bot/read-only toast offers Reload, which runs the client's own full-state read instead of a page reload that would drop the composer.
|
Tip for review: |
|
@Birfy — review request for
The body's |
|
Verdict: PASS at 6d18a0a Ran at this tip: Tier and CI at this head. The enqueue-guard check run at this tip reads Red first. With What I read. Notes, none blocking. The head is in the fork No conclusion named this tip before this one. |
Fixes #2312
Owner: Dev-4
Reviewer: Birfy
Written-by: Dev-4
Claim-Id: b61a0658646e45e197952e9f4c5f9870
Branch: dev/4-readonly-toast-code
Tip: 6d18a0a
Tree: df3fd93dae966e8f00665d90f985b5b8583a9f4c
Base: 868efa7
Diff: 10 files, +448/−34
Tier: T1
why: [] — every path this PR touches is T1 or T0 under the live
risk-rules.jsonat this base (core/src/client/**,core/test/**,core/client.js,patches/ds-bot/**,changelog.d/**T1;docs/subsystems/core-client.mdT0)Docs-changed: docs/subsystems/core-client.md (+1)
What was wrong
A refused action away from any form lost the host's code.
reportErrorincore/src/client/index.jsbuilt the toast payload fromerror.messagealone, so a refusal that came back asbot/read-onlyread as a bare sentence with one link into Settings → Feedback: a reader could not tell that this particular refusal was the one failure the window can end by itself, and could not act on it short of a page reload that drops whatever is in the composer.The host does send the code, and the read-only banner's Reload already acts on the same failure:
core/src/client/sidebar.js:378callsactions.reloadTeam(defined incore/src/client/index.js:470) to read the whole team again instead of reloading the page that would drop the composer (#2247). The toast never carried the code, so it drew only text and Details.What changed
core/src/client/index.js(+4/−1) —reportErrorputserror.codeinto the toast payload it sets, so the toast carries the code the host sent.core/src/client/feedback.js(+11) —ErrorToastdraws that code as abt-tag bt-toast-codewhen there is one, and abot/read-onlytoast draws Reload (bt-toast-reload) beside Details. Reload dismisses the toast and runsactions.reloadTeam?.()— the client's own full-state read — so the window becomes writable once the other holder has let go, without the page reload that would drop the composer. A read that fails is reported throughactions.reportError?.(error, 'reload'), the way the sidebar's Reload is. Every other code, and a toast with no code, keeps the sentence and Details exactly as before.core/test/error-toast-code.test.js(+180, new file) — six tests: the tag names the code; a read-only toast offers Reload and the click reads the team in place; another failure keeps its code and offers no Reload; a toast with no code draws no tag and keeps Details; a failing reload goes through the error channel instead of an unhandled rejection;reportErrorkeeps the code in the payload it sets.docs/subsystems/core-client.md(+1) — the client-subsystem row records the code on the toast and the in-place Reload.changelog.d/2312-readonly-toast-code.fixed.md— the user-visible entry.Generated artifacts at this tip, all written by
node scripts/ds-bot-patches.mjs generate(nothing hand-edited):core/client.js(+10/−1) is whatnode core/scripts/build-client.mjswrites from those two sources.patches/ds-bot/0001-core-fixes.patch(+13/−2) carries thesrc/client/feedback.jshunks; on this base it also inherits the#2360/#2363diagnostics changes that landed in main, which is why it is not empty.patches/ds-bot/0003-flybot-api-client.patch(+8/−2) andpatches/ds-bot/0008-client-bundle.patch(+40/−28) are the regenerated mirrors of the client sources and the bundle.patches/ds-bot/files/test/error-toast-code.test.js(+180) is the verbatim mirror of the new test, because upstream does not have that path.On this base
0008moves by+40/−28only: the whole-file re-lay seen against the previous base was a property of that base, and with#2363in main the bundle patch no longer re-lays the entire file.Red first (clean
868efa73f127c1a4ece2b941c61aaa6c95b172fe, new test only)node --import ./test/harness-resolve.mjs --test test/error-toast-code.test.jsincore/on an otherwise clean tree: 6 tests, 1 pass, 0 cancelled, 5 fail. The five reds are the new behaviour and nothing else:P-502: the toast names the code the host sentP-502: a read-only toast offers a Reload that reads the team again in placeP-502: another failure keeps its code and offers no ReloadP-502: a reload that fails says so through the error channel, not an unhandled rejectionP-502: reportError keeps the host code in the toast payload it setsAfter the fix the same file is 6 / 6 pass, 0 fail, 0 cancelled.
Verification at this tip (
6d18a0a8fbb5f5c5a2c0b0435b183c2566730a44, treedf3fd93dae966e8f00665d90f985b5b8583a9f4c)Ran on the tree this PR carries —
TZ=UTC ARCH_DOCS_BASE=868efa73f127c1a4ece2b941c61aaa6c95b172fe npm run verify: 4771 tests / 4771 pass / 0 fail / 0 cancelled, exit 0. Suites: core 2784, 570, 132, 140, 411, 671, 37, 26. Core lint 74 warnings / 0 errors; plugin lint in pairs all 0 errors (social 36, timeline 9, tree 2, workflow 16);lint:interop1 warning / 0 errors,lint:live-e2e0 / 0;arch-docs: OK (10 changed file(s)).ds-bot-patches checkok (10 patches apply in order),canonicalok (generate is a no-op),build-client --checkok (exit 0),changelog check13 fragments well formed,check-mojibake0 occurrences. A secondgenerateon the committed tree changes nothing.Not run: nothing — the full
verifyran to the end at this tip.{ "pr": 2367, "claim": "Dev-4", "issue": 2312, "summary": "An error toast lost the host's code: reportError built it from error.message alone, so a bot/read-only refusal read as a bare sentence with only a Details link. reportError now carries error.code into the toast payload, and feedback.js draws it as bt-tag bt-toast-code; a bot/read-only toast offers Reload in place, dismisses the toast and runs actions.reloadTeam, so the window becomes writable without a page reload, and a failing read goes to reportError(error, 'reload'). Other codes keep the sentence and Details. Six tests; docs, changelog and generated mirrors at this tip.", "files": [ "core/src/client/index.js", "core/src/client/feedback.js", "core/test/error-toast-code.test.js", "core/client.js", "docs/subsystems/core-client.md", "changelog.d/2312-readonly-toast-code.fixed.md", "patches/ds-bot/0001-core-fixes.patch", "patches/ds-bot/0003-flybot-api-client.patch", "patches/ds-bot/0008-client-bundle.patch", "patches/ds-bot/files/test/error-toast-code.test.js" ], "checks": { "ran": "npm run verify (4771 tests / 0 fail), core lint 0 errors, ds-bot-patches check+canonical, build-client --check, changelog check, mojibake, arch-docs (10 files)", "result": "green", "at": "6d18a0a8fbb5f5c5a2c0b0435b183c2566730a44" }, "next": "none — ready for review" }